using System;
using System.Reflection;

namespace UnitTesting.Fixturing
{
	class ConstructorsForDynamicProxy : IConstructors
	{
		public ConstructorInfo[] GetFor(Type type)
		{
			Ensure.IsNotNull(() => type);
			return DynamicProxyReflector.IsInternalVisibleType(type)
			       	? IncludeInternals(type)
			       	: NotIncludeInternals(type);
		}

		protected virtual ConstructorInfo[] IncludeInternals(Type type)
		{
			return new Constructors(Visibilities.NotPrivate).GetFor(type);
		}

		protected virtual ConstructorInfo[] NotIncludeInternals(Type type)
		{
			return new Constructors(Visibilities.PublicOrProtected).GetFor(type);
		}
	}
}